-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add performance metrics commands #657
Conversation
Thanks for the pull request, @Ian2012! Please note that it may take us up to several weeks or months to complete a review and merge your PR. Feel free to add as much of the following information to the ticket as you can:
All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here. Please let us know once your PR is ready for our review and all tests are green. |
db3cc91
to
612f5e0
Compare
612f5e0
to
5a2dcba
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great, I'm excited to start getting some real measurements on these that we can iterate on!
tutoraspects/templates/aspects/apps/superset/pythonpath/performance_metrics.py
Outdated
Show resolved
Hide resolved
tutoraspects/templates/aspects/apps/superset/pythonpath/performance_metrics.py
Outdated
Show resolved
Hide resolved
tutoraspects/templates/aspects/apps/superset/pythonpath/performance_metrics.py
Outdated
Show resolved
Hide resolved
tutoraspects/templates/aspects/apps/superset/pythonpath/performance_metrics.py
Show resolved
Hide resolved
@@ -3,10 +3,10 @@ with grades as ( | |||
from {{ DBT_PROFILE_TARGET_DATABASE }}.fact_grades | |||
where grade_type = 'course' | |||
{% raw %} | |||
{% if filter_values('course_name') != [] %} | |||
{% if get_filters('course_name', remove_filter=True) != [] && filter_values('course_name') != [] %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious about the effect of remove_filter
here. Did it have a performance impact? @SoryRawyer do you think it might cause problems with our predicate pushdown workarounds?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding of remove_filter
is that it prevents Superset from adding the filter to the final generated SQL. I've used it in the past when we want to filter on a column in a subquery but don't want to include that column in the final result. What's not clear to me is how this would affect subsequent calls to filter_values('course_name')
within this query.
Additionally, the get_filters
check feels redundant; I can't tell if there will be a case where that returns a different answer than the comparison on filter_values('course_name')
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It shouldn't be in the same condition, I was testing some changes. The final SQL should be:
{% if get_filters('course_name', remove_filter=True) != [] %}
# When there are no filters defined (such as in the SQL Lab, programmatic access, or when creating charts)
# Do nothing, no filter
{% if filter_values('course_name') != [] %}
# Bassically in the dashboard context
# Do the filter thing
{% else %}
1=0
{% endif %}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_filters
returns the applied filters to a column in a list with the comparator and the value. See https://superset.apache.org/docs/installation/sql-templating/#available-macros
f5feea7
to
cbf3bf9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, remember to squash 😅
@Ian2012 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future. |
Description
This PR does the following changes:
query_context
param in charts to query data from charts programmatically.performance-metrics
command that queries the data on all theSUPERSET_EMBEDDABLE_DASHBOARDS
charts and gets the data needed for performance measurements. Every query performed (by clickhouse-connect) is attached a customhttp_user_agent
following this formataspects-{ASPECTS_VERSION}-{UUID[0:6]}
so that those queries can be retrieved and matched later.The output is sorted from slowest to fastest. An example output is here:
The following chart and its dataset are created to visualize the queries performed from this tool:
Pending changes